import { rcaNumberFormat,get_month_first,get_date } from './common.js'
import { commonTableOption } from './common.js'
export const startDate = get_month_first(0);
export const endDate = get_date(0);
export const tableOption = {
  ...commonTableOption,
  menu: true,
  editBtn: false,
  delBtn: false,
  column: [{
    type: 'input',
    showSummary: true,
    precision: 2,
    formatter: (row, value, label, column) => {
      return rcaNumberFormat(value, true)
    },
    label: '微信支付金额',
    prop: 'wechatMoney'
  }, {
    type: 'input',
    showSummary: true,
    precision: 2,
    formatter: (row, value, label, column) => {
      return rcaNumberFormat(value, true)
    },
    label: '支付宝支付金额',
    prop: 'alipayMoney'
  }, {
    type: 'date',
    label: '时间',
    prop: 'tradeDate',
    searchValue: [startDate, endDate], 
    searchSpan: 12,
    searchRange: true,
    search: true,
    valueFormat: 'yyyy-MM-dd',
  }]
}


export const tableOption1 = {
  ...commonTableOption,
  page: false,
  refreshBtn: false,
  columnBtn: false,
  column: [
    {
      type: 'date',
      label: '交易日期',
      prop: 'tradeDate'
    }, {
      type: 'select',
      label: '线路',
      prop: 'lineCode',
      cascaderItem: ['stationCode'],
      props: {
        label: 'name',
        value: 'code'
      },
      dicUrl: '/support/swparamline/dictAll',

    }, {
      type: 'select',
      label: '车站',
      prop: 'stationCode',
      props: {
        label: 'name',
        value: 'code'
      },
      dicFlag: false,
      dicUrl: `/support/swparamstation/dict/{{key}}`,
    }, {

      type: 'input',
      label: '票种',
      prop: 'ticketName'
    }, {
      type: 'input',
      showSummary: true,
      label: '数量',
      prop: 'amount'
    }, {

      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value, true)
      },
      label: '金额',
      prop: 'money'
    }, {
      type: 'input',
      label: '数据提醒',
      prop: 'errMsg',
      slot: true
    }]
}


export const confirmTableConfigMap = {
  '1': {
    option: tableOption1,
    dataFormat: (data) => data
  },
  '2': {
    option: tableOption1,
    dataFormat: (data) => data
  },
}
